<?php
$content_width = 520;

require_once (get_stylesheet_directory().'/theme-options.php');

function sncmono_scripts() {
	wp_enqueue_script('sncmono_search_bar', get_template_directory_uri().'/functions.js');
}
add_action('wp_enqueue_scripts', 'sncmono_scripts');

function sncmono_sidebars() {
	register_sidebar();
}
add_action('widgets_init', 'sncmono_sidebars');

function sncmono_theme_setup() {
	add_theme_support('automatic-feed-links');
	add_theme_support('post-thumbnails');
	add_theme_support('menus');
	set_post_thumbnail_size(150, 150);
 }
add_action('after_setup_theme', 'sncmono_theme_setup');

function sncmono_register_custom_menu() {
	register_nav_menu('horizontal_menu', __('Horizontal Menu', 'snc-mono'));
}
add_action('init', 'sncmono_register_custom_menu');

function sncmono_comment($comment, $args, $depth) {
	$GLOBALS['comment'] = $comment;
	?>
	<li>
		<div id="comment_<?php comment_ID(); ?>" class="comment">
			<div id="comment_info"><?php echo get_avatar($comment->comment_author_email, 48); ?></div>
			<div id="comment_content">
				<div id="comment_link"><a href="#comment_<?php comment_ID() ?>">#<?php comment_ID() ?></a></div>
				<div id="comment_author"><?php echo get_comment_author_link() ?></div>
				<?php if ($comment->comment_approved == '0'): ?>
					<em><?php _e('Your comment is waiting for an approval.', 'snc-mono') ?></em>
				<?php endif; ?>
				<div id="comment_text"><?php comment_text() ?></div>
				<div id="comment_reply"><?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?></div>
				<div id="comment_date"><?php echo get_comment_time() ?> | <?php echo get_comment_date() ?><?php edit_comment_link(__('Edit', 'snc-mono'), ' | '); ?></div>
			</div>
			<div id="clear"></div>
		</div>
		<?php
}

function sncmono_custom_header() {
	$options = get_option('sncmono_theme_options');
	echo '<style type="text/css">';
	if ($options['header_color']) {
		?>
		#top {
			background-color: <?php echo $options['header_color']; ?>;
		}
		<?php
	} else {
		?>
		#top {
			background-color: #444;
		}
		<?php
	}
	echo '</style>';
}
add_action('wp_head', 'sncmono_custom_header');

function threecircles_credit() {
	$options = get_option('sncmono_theme_options');
	if ($options['credit'] == 1) { echo 'Designed by <a href="http://threecircles.pl/" target="_blank">Three Circles</a>.'; }
}
?>